package com.xyoto.community.controller;

import com.xyoto.community.aspect.annotation.RequiresLogin;
import com.xyoto.community.dto.RemoveFanFollowDTO;
import com.xyoto.community.dto.SaveFanFollowDTO;
import com.xyoto.community.service.FanFollowService;
import com.xyoto.community.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/fan")
@Api(value = "粉丝关注（前台）", tags = "粉丝关注（前台）")
public class FanFollowController {

    @Autowired
    private FanFollowService fanFollowService;

    @RequiresLogin
    @ApiOperation(value = "关注用户（前台）", notes = "关注用户")
    @PostMapping("/saveFollow")
    public Result saveFollow(@RequestBody @Validated SaveFanFollowDTO saveFanFollowDTO){
        return fanFollowService.saveFollow(saveFanFollowDTO);
    }

    @RequiresLogin
    @ApiOperation(value = "取消关注（前台)", notes = "取消关注（前台)")
    @DeleteMapping("/removeFollow")
    public Result removeFollow(@RequestBody @Validated RemoveFanFollowDTO removeFanFollowDTO){
        return fanFollowService.removeFollow(removeFanFollowDTO);
    }

}
